/**
 *
 */
package com.longrise.common.utils;

import android.os.Environment;

import com.longrise.common.utils.AppUtil;

import java.io.File;

/**
 * simple introduction
 * <p>
 * <p>
 * detailed comment
 *
 * @author Administrator 2015-12-31
 * @see
 * @since 1.0
 */
public class FolderConstants {

    private static final String ROOT_CACHE_DIR = getDiskCacheDir();

    private static final String ROOT_FILE_DIR = getDiskFileDir();

    private static String getDiskCacheDir() {
        String cachePath = null;
        if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState()) || !Environment.isExternalStorageRemovable()) {
            File externalCacheDir = AppUtil.getContext().getExternalCacheDir();
            if (externalCacheDir != null) {
                cachePath = externalCacheDir.getPath();
            } else {
                cachePath = AppUtil.getContext().getCacheDir().getPath();
            }
        } else {
            cachePath = AppUtil.getContext().getCacheDir().getPath();
        }
        return cachePath;
    }

    private static String getDiskFileDir() {
        String cachePath = null;
        if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState()) || !Environment.isExternalStorageRemovable()) {

            File externalFilesDir = AppUtil.getContext().getExternalFilesDir("");
            if (externalFilesDir != null) {
                cachePath = externalFilesDir.getPath();
            } else {
                cachePath = AppUtil.getContext().getFilesDir().getPath();
            }
        } else {
            cachePath = AppUtil.getContext().getFilesDir().getPath();
        }
        return cachePath;
    }


    /**
     * 视频路径
     */
    public static final String VIDEO_DIR = ROOT_FILE_DIR + "/video/";

    /**
     * 存放app的icon
     */
    public static final String ICON_DIR = ROOT_FILE_DIR + "/icon";

    /**
     * APP其他缓存目录
     */
    public static final String APK_DIR = ROOT_CACHE_DIR + "/apk";

    /**
     * bb拍照后保存路径
     */
    public static final String BB_CAMERA_DIR = ROOT_CACHE_DIR + "/camera/";

    /**
     * 客服
     */
    public static final String CSPIC_DIR = ROOT_CACHE_DIR + "/cs/";

    /**
     * 保存图片地址
     */
    public static final String SAVE_PHOTO = ROOT_CACHE_DIR + "/保宝/";

    /**
     * 广告缓存文件夹
     */
    public static final String AD_DIR = ROOT_CACHE_DIR + "/ad";

    /**
     * 产品费率拍照或选择照片的文件夹
     */
    public static final String PRODUCTFEE_PIC_DIR = ROOT_CACHE_DIR + "/productfee/";

    /**
     * 缓存文件夹
     */
    public static final String CACHE_DIR = ROOT_CACHE_DIR;

    /**
     * FileProvider
     */
    public static final String FILE_PROVIDER = "com.longrise.android.byjk.fileprovider";


    /**
     * 海报分享的图片地址
     */
    public static final String SHARE_POSTER = ROOT_CACHE_DIR + "/share/";

}
